package space.jamestang.simpleci.schema

import org.ktorm.schema.*

@Suppress("unused")
object BuildLogs: Table<BuildLog>("simple_build_log") {

    val id = int("id").primaryKey().bindTo { it.id }
    val projectId = int("project_id").bindTo { it.projectId }
    val buildNumber = int("build_number").bindTo { it.buildNumber }
    val status = varchar("status").bindTo { it.status }
    val log = text("log").bindTo { it.log }
    val startTime = long("start_time").bindTo { it.startTime }
    val endTime = long("end_time").bindTo { it.endTime }
    val duration = long("duration").bindTo { it.duration }
}

// SQL:
// CREATE TABLE simple_build_log (
//     id INT PRIMARY KEY AUTO_INCREMENT,
//     project_id INT NOT NULL,
//     build_number INT NOT NULL,
//     status VARCHAR(255) NOT NULL,
//     log TEXT NOT NULL,
//     start_time BIGINT NOT NULL,
//     end_time BIGINT NOT NULL,
//     duration BIGINT NOT NULL
// );